<?php
//$dsn = 'sqlite:ChinazSeo.db';
try
{
    //$dbh = new PDO($dsn, $user, $password);　 //建立连接
    $dbh = new PDO('sqlite:ChinazSeo.db');//如果没有找到.db文件，就新建一个
   
    //$dbh = new PDO('sqlite:itlife365.com');
    //echo 'Create Db ok' ;
    //建表
    //$dbh->exec("CREATE TABLE itlife365(id integer,name varchar(255))");
    //echo 'Create Table itlife365 ok<BR>';
    //$dbh->exec("INSERT INTO itlife365 values(1,'itlife365.com')");
    //echo 'Insert Data ok<BR>';
    //$dbh->beginTransaction();
    $sth = $dbh->prepare('SELECT * FROM DomainData'); 
    $sth->execute();
    //获取结果
    $result = $sth->fetchAll();//查询结果并将结果全部赋值给数组


    $fin=0;
    $len= count($result);//获取数组长度
    for ($i=0; $i <$len ; $i++) //循环数据库数组
    { 
        $DomainSq=$result[$i]['DomainSq'];
        $del=$dbh->exec("DELETE FROM 'DomainData' where DomainSq='".$DomainSq."'"); //删除域名
        echo "删除域名".$result[$i]['DomainName'] ."影响行--".$del.'<br />';
        $del=$dbh->exec("DELETE FROM 'KeyWordManage' where DomainSq='".$DomainSq."'"); //删除关键词
        echo "删除关键词".$result[$i]['DomainName'] ."影响行".$del.'<br />';
            
    }
    echo "操作完成！";
    //$dsn=null;
}
catch (PDOException $e)
{
    echo 'Connection failed: ' . $e->getMessage();
    //$dsn = null;
}
?>
</html>
<?php $dbh = null;//或使用unset($dbh); ?>